<%@page import="sams.ck.entity.Student"%>
<%@ page language="java" contentType="text/html; charset=utf-8" import="java.util.List,sams.ck.entity.*"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Student List</title>
<%@ include file="head.jsp" %>
</head>
<body>

	<table width='500px' border='5px' class="table" >
		
		<form action="toInquiryStu.do" method="post">
			<input placeholder="请输入您的学号" name="stuId" ><input type="submit" value="查询">
		</form>
		&ensp;
		<input type="button" class="button" value="添加" onclick="location='addStu.jsp'"/>
		
		
		<tr>
			<td>学号</td>
			<td>姓名</td>
			<td>班级</td>
			<td>语文</td>
			<td>数学</td>
			<td>英语</td>
			<td>总分</td>
			<td>操作</td>
		</tr>
		<%            
			//java代码
			//到request中取出 绑定的数据
			List<Student>stus=(List<Student>)request.getAttribute("stus");
			//循环迭代 数据并显示
			for(Student stu:stus){
		%>
		<tr>
			<td>
				<%=stu.getStuId() %>
			</td>
			<td>
				<%=stu.getStuName() %>
			</td>
			<td>
				<%=stu.getStuClass() %>
			</td>
			<td>
				<%=stu.getChineseScore() %>
			</td>
			<td>
				<%=stu.getMathScore() %>
			</td>
			<td>
				<%=stu.getEnglisScore() %>
			</td>
			<td>
				<%=stu.getEnglisScore()+stu.getMathScore()+stu.getChineseScore() %>
			</td>
			<td>
				<input type="button" class="button" value="删除" onclick="location='delStu.do?stuId=<%=stu.getStuId() %>'"/>
				<input type="button" class="button" value="修改" onclick="location='toUpdateStu.do?stuId=<%=stu.getStuId() %>'"/>
			</td>
		</tr>
		<%} %>
	</table>
					<%
						stuPage p=(stuPage)request.getAttribute("page");
						int cur=p.getCurrentPage();
						int totalPage=p.getTotalPage();
					%>
					<p>
						<%
							if(cur!=1){
						%>
							<a href="stuList.do?current=<%=cur-1%>">上一页</a>
						<%
							}						
						%>
						<%
							for(int i=1;i<=totalPage;i++){
						%>
						<a href="stuList.do?current=<%=i%>"><%=i %></a>
						<%
							}
						%>
						<%
							if(cur!=totalPage){
						%>
							<a href="stuList.do?current=<%=cur+1%>">下一页</a>
						<%
							}						
						%>
					</p>
</body>
</html>